package util


type QueueTreeNode struct {
	Data []*TreeNode
}

func (r *QueueTreeNode) Push(v *TreeNode) {
	r.Data = append(r.Data, v)
}

func (r *QueueTreeNode) Pop() (*TreeNode, error) {
	if r.IsEmpty() {
		return nil, ErrQueueIntIsEmpty
	}
	tmp := r.Data[0]
	r.Data = r.Data[1:]
	return tmp, nil
}

func (r *QueueTreeNode) IsEmpty() bool {
	if len(r.Data) == 0 {
		return true
	}
	return false
}

func (r *QueueTreeNode) Peek(v *TreeNode) (*TreeNode, error) {
	if r.IsEmpty() {
		return nil, ErrQueueIntIsEmpty
	}
	return r.Data[0], nil
}


func NewQueueTreeNode()*QueueTreeNode{
	return &QueueTreeNode{Data: make([]*TreeNode,10)}
}